home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 September / PCWorld_2004-09_cd.bin / software / topware / winamp / winamp504_full.exe / $R0 / Winamp Modern / shadecontrol.m < prev    next >
Text File  |  2004-07-01  |  5KB  |  177 lines

  1. #include <lib/std.mi>
  2. #include "attribs.m"
  3.  
  4. function setObjects(int w);
  5. function setSongtickerScrolling();
  6.  
  7. Global Group frameGroup, gX1,gX2,gX3,display,display2,displaytimer,displayticker,displayvis;
  8. Global Button btnExpand,btnReduce,shadeeq;
  9. Global Layout main;
  10. Global Layout main_normal;
  11. Global Layer volumebar;
  12. Global Text SongTicker;
  13. Global Button colorthemes;
  14.  
  15. System.onScriptLoaded() {
  16.     initAttribs();
  17.  
  18.     frameGroup = getScriptGroup();
  19.     main = frameGroup.getParentLayout();
  20.     main_normal = frameGroup.getParentLayout().getContainer().getLayout("normal");
  21.     gX1 = frameGroup.findObject("shadeX1");
  22.     gX2 = frameGroup.findObject("shadeX2");
  23.     gX3 = frameGroup.findObject("shadeX3");
  24.     shadeeq = frameGroup.findObject("shadeeq");
  25.     display = frameGroup.findObject("shadedisplay");
  26.     display2 = frameGroup.findObject("shadedisplay2");
  27.     displaytimer = frameGroup.findObject("shadetimer");
  28.     displayticker = frameGroup.findObject("shadeticker");
  29.     displayvis = frameGroup.findObject("shadevis");
  30.     btnExpand = frameGroup.findObject("shade.expand");
  31.     btnReduce = frameGroup.findObject("shade.reduce");
  32.     colorthemes = frameGroup.findObject("shadect");
  33.  
  34.     SongTicker = frameGroup.findObject("SongtickerShade");
  35.  
  36.     volumebar = frameGroup.findObject("volumebarShade");
  37.     volumebar.setXmlParam("w",integertostring( (system.getVolume()/255) *40 + 5));
  38.  
  39.     setSongtickerScrolling();
  40.  
  41. }
  42.  
  43. frameGroup.onResize(int x, int y, int w, int h) {
  44.   setObjects(w);
  45. }
  46.  
  47. shadeeq.onLeftClick() {
  48.   eq_visible_attrib.setData("1");
  49. }
  50.  
  51. setObjects(int w) {
  52.  
  53.     int ShowButtons=getPrivateInt("winamp5", "ShowShadeButtons", 0);
  54.  
  55.     if (ShowButtons) {
  56.         btnExpand.show();
  57.         btnReduce.hide();
  58.     } else {
  59.         btnExpand.hide();
  60.         btnReduce.show();
  61.     }
  62.  
  63.     gX1.hide();
  64.     gX2.hide();
  65.     gX3.hide();
  66.     display.hide();
  67.     display2.hide();
  68.     displaytimer.hide();
  69.     displayticker.hide();
  70.     displayvis.hide();
  71.  
  72.     if (w>400) {
  73.         int w_display=w-356;
  74.         display.setXMLParam("w", integertostring(w_display));
  75.         display.show();
  76.         displaytimer.show();
  77.  
  78.         if (w>420) {
  79.             displayticker.show();
  80.             displayticker.setXMLParam("w", integertostring(w_display));
  81.  
  82.  
  83.  
  84.  
  85.             if (w>560) {
  86.                 display.hide();
  87.                 display2.setXMLParam("w", integertostring(w_display-45));
  88.                 display2.show();
  89.                 displayticker.setXMLParam("w", integertostring(w_display-56));
  90.  
  91.                 if (ShowButtons) {
  92.                     gX1.setXMLParam("x", "-100");
  93.                     gX1.show();
  94.  
  95.                     if (w>583) {
  96.                         display2.setXMLParam("w", integertostring(w_display-68));
  97.                         displayticker.setXMLParam("w", integertostring(w_display-79));
  98.  
  99.                         gX1.setXMLParam("x", "-123");
  100.  
  101.                         gX2.setXMLParam("x", "-80");
  102.                         gX2.show();
  103.  
  104.                         if (w>642) {
  105.                             display2.setXMLParam("w", integertostring(w_display-127));
  106.                             displayticker.setXMLParam("w", integertostring(w_display-138));
  107.  
  108.                             gX1.setXMLParam("x", "-182");
  109.  
  110.                             gX2.setXMLParam("x", "-139");
  111.  
  112.                             gX3.setXMLParam("x", "-116");
  113.                             gX3.show();
  114.  
  115.                             if (w>660) {
  116.                                 displayvis.setXMLParam("x", integertostring(-257));
  117.                                 displayvis.show();
  118.                                 displayticker.setXMLParam("w", integertostring(w_display-194));
  119.                             }
  120.  
  121.                         }
  122.                     }
  123.                 } else {
  124.                     display2.setXMLParam("w", integertostring(w_display));
  125.                     displayvis.setXMLParam("x", integertostring(-130));
  126.                     displayvis.show();
  127.                     displayticker.setXMLParam("w", integertostring(w_display-66));
  128.  
  129.                 }
  130.  
  131.             }
  132.         }
  133.     }
  134. }
  135.  
  136. System.onKeyDown(String key) {
  137.   if (StrLeft(key,4) == "ctrl" && StrSearch(key, "+w") != -1 && (main.isActive() || main_normal.isActive())) {
  138.     if (main.isVisible())
  139.       main.getContainer().switchToLayout("normal");
  140.     else
  141.       main.getContainer().switchToLayout("shade");
  142.     complete;
  143.   }
  144. }
  145.  
  146. btnExpand.onleftClick() {
  147.     setPrivateInt("winamp5", "ShowShadeButtons", 0);
  148.     setObjects(main.getGUIw());
  149. }
  150.  
  151. btnReduce.onleftClick() {
  152.     setPrivateInt("winamp5", "ShowShadeButtons", 1);
  153.     setObjects(main.getGUIw());
  154. }
  155.  
  156. System.onvolumechanged(int newvol)
  157. {
  158.     volumebar.setXmlParam("w",integertostring( (newvol/255) *40 + 5));
  159. }
  160.  
  161. songticker_scrolling_enabled_attrib.onDataChanged() {
  162.     setSongtickerScrolling();
  163. }
  164.  
  165. setSongtickerScrolling() {
  166.     if (songticker_scrolling_enabled_attrib.getData()=="1") {
  167.         SongTicker.setXMLParam("ticker","1");
  168.     } else {
  169.         SongTicker.setXMLParam("ticker","0");
  170.     }
  171. }
  172.  
  173. colorthemes.onRightButtonDown(int x, int y) {
  174.   triggerAction(colorthemes, "ThemesSlotsMenu", "");
  175.   complete;
  176. }
  177.